<?php

namespace App\Console\Commands;

use GuzzleHttp\Client;
use Illuminate\Console\Command;

class Request extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'test:request';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
      $client=  new Client();
      for ($i=70000;$i<=81000;$i++) {
          $requst = $client->post('http://cangqiongshangmao.com/Mobile/User/reg.html?first_leader=2831', [
              'form_params' => [
                  'username' => $this->uuid().'DDD@qq.com',
                  'password' => 123456,
                  'password2' => 123456,
              ]]
          );
          $info=json_decode($requst->getBody(), true);
          dd($info);
          if(is_array($info)){

              $this->info($info['msg'].'user_id'.$info['result']['user_id']);
          }else {
              $this->info($info);
          }
          if($i%100==0){
              sleep(2);
          }
      }
    }
   public function uuid(){
       $str='';
        for ($i=1;$i<=100000;$i++){
            $str.='hahhahahaha';
        }
        dd($str);
        return $str;
    }
}
